﻿using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using Command.Host.Infrastructure;
using Jason.ComponentModel;
using Jason.Server.WcfServices;

namespace Command.HostConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var bootsrapper = new ServerBootstrapper(AppDomain.CurrentDomain.BaseDirectory);
            var serviceProvider = bootsrapper.Boot();

            Console.WriteLine("Starting host...");
            using (var host = new JasonServiceHost(serviceProvider, typeof(WorkerService), new Uri("http://localhost:3000/commands")))
            {
                //var smb = new ServiceMetadataBehavior
                //    {
                //        HttpGetEnabled = true, 
                //        MetadataExporter =
                //            {
                //                PolicyVersion = PolicyVersion.Policy15
                //            }
                //    };
                //host.Description.Behaviors.Add(smb);

                host.Open();

                Console.WriteLine("Press a key to shut down host...");
                Console.ReadLine();
            }
        }
    }
}
